<tr id="course_view-<%= object.code %>" class="grid_rows <%= "published_false" unless object.is_deleted %>">
  <td class="row_chkbox">
    <input type="checkbox"/>
  </td>
  <td class="row_title">
    <%= link_to  " &mdash; " * level + object.name, {:action=>'edit', :id=> object.id}  %> 
    <span class="miniText"> [<%= object.code %>] </span> <br/>
    <div class="meta-links">
      <span class="meta-link"><%= link_to 'Edit', {:controller => '/admin/courses', :action=>'edit', :id=> object.id} %></span>
      <span class="meta-link-separator">|</span>
      <span class="meta-link"><a onclick="toggleQuickEdit('<%= object.code %>', 'course')">Quick Edit</a> </span>
      <span class="meta-link-separator">|</span>
      <span class="meta-link">Delete</span>
      <span class="meta-link-separator">|</span>
      <span class="meta-link"><%= link_to 'View', {:controller => '/admin/courses', :action=>'show', :id=> object.id} %></span>
    </div>
  </td>
  <td class="row_meta">
    <%  if object.is_deleted  %>
      <span class="miniText">Published</span>
    <% else %>
      <span class="miniText">Unpublished</span>
    <% end %>
  </td>
  <td class="row_dates">
    <span class="miniText">Start date :<i> <%= object.start_date %> </i> </span><br/>
    <span class="miniText">End date :<i> <%= object.end_date %> </i> </span>
  </td>
</tr>

<tr class="grid_rows inline-editor" id="course_edit-<%= object.code %>">
  <td class="quick-edit" colspan="6">
    <h4>QUICK EDIT</h4>
    <div class="inline-edit half-width float-left">
      <div class="label-field-pair">
        <span class="attrib">Name</span>
        <input type="text" class="input-inline" value="<%= object.name %>"/>
      </div>
      <div class="label-field-pair">
        <span class="attrib">Code</span>
        <input type="text" class="input-inline" value="<%= object.code %>"/>
      </div>
      
      <div class="label-field-pair">
        <span class="attrib">Start date</span>
        <input type="text" class="input-inline datetype" value="<%= object.start_date %>"/>
      </div>
      
      <div class="label-field-pair">
        <span class="attrib">End date</span>
        <input type="text" class="input-inline datetype" value="<%= object.end_date %>"/>
      </div>
      
    </div>
    <div class="inline-edit half-width float-left right-div-with-border">
      <div class="label-field-pair">
        <span class="attrib">Parent Batch</span>
        <%= tree_batch_select(Batch.find(:all, :conditions => "parent_batch_id = 0"), 'course', 'parent_batch_id', object,0, "select-inline") %>
      </div>
      
      <div class="label-field-pair">
        <span class="attrib">Parent Course</span>
        <%= tree_course_select(Course.find(:all, :conditions => "parent_batch_id = 0"), 'course', 'parent_course_id', object,0, "select-inline") %>
      </div>
      
      <div class="label-field-pair">
        <span class="attrib">Published</span>
        <input type="checkbox" value="true" id="publish"/> 
      </div>
    </div>
    <div class="clear"></div>
    <p>
        <input type="button" class="button" value="Cancel" onclick="toggleQuickEdit('<%= object.code %>', 'course')"/>
        <span class="button_separator"></span>
        <input type="button" class="submit_button" value="Update" onclick="alert('ajax update');"/>
    </p>
  </td>
</tr>

<% object.children.each do |child| %>
  <%= render :partial => "courserow", :object => child, :as => :object, :locals => {:level => level+1} %>
<% end %>